<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>处理订单页面</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/util.js"></script>
    <script>
        window.onload=function (){
            showProductInfo(1);
        }
        async function showProductInfo(pageNo) {
            let info = await ajaxGet("/order/findByItem",{
                pageNo,
                status:$("status").value,
                startDate:$("startDate").value,
                endDate: $("endDate").value
            });
            let cutStr ="";
            for (let i = 1; i < info.pages; i++) {
                cutStr+=`<a style="margin-right: 12px;" href="javascript:showProductInfo(${i})">${i}</a>`;
            }
            $("cutDiv").innerHTML=cutStr;

            let str="";
            for (let i = 0; i <info.list.length; i++) {
                let obj = info.list[i];
                str+=`<tr>
                <td>${obj.id}</td>
                <td>${obj.orderMoney}</td>
                <td>${obj.status}</td>
                <td>${obj.date}</td>
                <td><a href="javascript:findById(${obj.id})">查看详情</a></td></tr>`;
            }
            $("data").innerHTML=str;
        }

        async function findById(id){
                location.href="/html/manager/orderInfo.html?orderId="+id;
        }

    </script>
</head>
<body>
<table border="1" cellspacing="0" width="60%">
    <thead><tr><th>订单号</th>><th>订单总价</th>><th>订单状态</th>><th>下单时间</th>><th>订单详情</th></tr></thead>
    <tbody id="data"></tbody>
</table>
    订单状态<select id="status">
    <option value="">不限</option>
    <option value="未发货">未发货</option>
    <option value="已发货">已发货</option>
    <option value="已完结">已完结</option>
</select><br>
    起始日期<input type="date" id="startDate"><br>
    结束日期<input type="date" id="endDate"><br>
    <input type="button" value="查询" onclick="showProductInfo(1)">
    <div id="cutDiv"></div>
</body>
</html>